package com.example.jee_springboot.mapper;

import com.example.jee_springboot.entity.Stu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface StuDAOByMybatis extends StuDao{
    @Select("select * from stu where id=#{id}")
    public Stu findById(@Param("id") long id);

    @Select("select * from stu")
    public List<Stu> findAll();

    @Select("insert into stu(username,pass)values(#{uname},#{uPassword})")
    public void insertStu(@Param("uname")String name,@Param("uPassword")String password);

    @Select("delete from stu where id=#{id}")
    public void deleteStu(@Param("id")long id);

}
